# encoding: utf-8
"""
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    created by lane.chang on '09/07/2024'
    comment: 对于chat gpt平台一些研究学习的探索
"""
from project.middleware.chatgpt import ChatGPT


class ChatGptService:

    @staticmethod
    def do_data_analysis():
        """
        :return:
        """
        import pandas as pd

        # 加载样例数据
        df_complex = pd.DataFrame({
            'Name': ['cat', 'tiger', 'monkey'],
            'Age': [25, 30, 35],
            'Salary': [50000.0, 100000.5, 150000.75],
            'IsMarried': [True, False, True]
        })

        df_complex.to_dict()

        system_text = f'你是一位优秀的数据分析师，现在有这样一份数据集：{df_complex}'
        uer_text = '请解释一下这个数据集的分布情况'

        chat_gpt = ChatGPT(model='moonshot-v1-32k')
        result = chat_gpt.llm(system_text=system_text, user_text=uer_text)

        print(result)


if __name__ == '__main__':

    # 数据分析
    ChatGptService.do_data_analysis()
